package com.bkgy.modular.tbSpcConfig.controller;

import com.alibaba.fastjson.JSONObject;
import com.bkgy.modular.tbSpcConfig.dto.TbSPCDisposeDto;
import com.bkgy.modular.tbSpcConfig.service.TbSPCDisposeService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author
 * @version 1.0
 * @ClassName tbSPCDispose
 * @date 2023/3/17 14:28
 */
@RestController
@RequestMapping("/tbSpcDispose")
public class TbSPCDisposeController {

    @Resource
    private TbSPCDisposeService tbSPCDisposeService;

    /**
     * 添加Spc配置
     * @param tbSPCDisposeDto
     * @return
     */
    @PostMapping("/saveSpcData")
    public ResultData saveSpcData(@RequestBody TbSPCDisposeDto tbSPCDisposeDto) {
        return tbSPCDisposeService.saveSpcData(tbSPCDisposeDto);
    }

    /**
     * 分页查询数据
     * @param jsonObject
     * @return
     */
    @PostMapping("/findByData")
    public ResultData findByData(@RequestBody JSONObject jsonObject) {
        return tbSPCDisposeService.findByData(jsonObject);
    }

    /**
     * 根据production_line&parameter_name进行查询更新
     * @param tbSPCDisposeDto
     * @return
     */
    @PostMapping("/updateData")
    public ResultData updateData(@RequestBody TbSPCDisposeDto tbSPCDisposeDto) {
        return tbSPCDisposeService.updateData(tbSPCDisposeDto);
    }

    /**
     * 批量删除接口
     * @param jsonObject
     * @return
     */
    @PostMapping("/deleteList")
    public ResultData deleteList(@RequestBody JSONObject jsonObject) {
        return tbSPCDisposeService.deleteList(jsonObject);
    }
}
